import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
//引入组件
import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
const routes = [
  {
    path: '/',
    redirect:'/home'
  },
  { path: '/home',
    name: 'Home',
    component: Home
  },
  { path: '/login',
    name: 'Login',
    component: Login
  },
  { path: '/register',
    name: 'Register',
    component: Register
  },
  { path: '/search',
    name: 'Search',
    component: Search
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
